// pages/detail/detail.js
const API = require("../../API/http.js");
Page({

   /**
    * 页面的初始数据
    */
   data: {
      songList:[]
   },

   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
      wx.showToast({
         title: '加载中',
         icon: "loading"
      });
      var {id} = options;
      API.getDetail(id).then(res=>{
         this.setData({
            songList: res.playlist.tracks
         })
      })
   },
   // 点击播放
   handlePlayAudio(event) {
      var id = event.currentTarget.dataset.id;
      wx.navigateTo({
         url: '/pages/play/play?id=' + id,
      })
   }
})